<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="__PUBLIC__/js/admin/html5.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/admin/respond.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/admin/PIE_IE678.js"></script>
<![endif]-->
<link href="__PUBLIC__/assets/css/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="__PUBLIC__/css/admin/style.css"/>       
<link href="__PUBLIC__/assets/css/codemirror.css" rel="stylesheet">
<link rel="stylesheet" href="__PUBLIC__/assets/css/ace.min.css" />
      <link rel="stylesheet" href="__PUBLIC__/Widget/zTree/css/zTreeStyle/zTreeStyle.css" type="text/css">
<link rel="stylesheet" href="__PUBLIC__/assets/css/font-awesome.min.css" />
<!--[if IE 7]>
		  <link rel="stylesheet" href="__PUBLIC__/assets/css/font-awesome-ie7.min.css" />
		<![endif]-->
<link href="__PUBLIC__/Widget/icheck/icheck.css" rel="stylesheet" type="text/css" />
<link href="__PUBLIC__/Widget/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
<link href="__PUBLIC__/css/layui/css/layui.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="__PUBLIC__/css/layui/layui.js"></script>
<title>新增图片</title>
</head>
<body>
<div class="clearfix" id="add_picture">
<div id="scrollsidebar" class="left_Treeview">
    <div class="show_btn" id="rightArrow"><span></span></div>
    <div class="widget-box side_content" >
    <div class="side_title"><a title="隐藏" class="close_btn"><span></span></a></div>
     <div class="side_list">
      <div class="widget-header header-color-green2">
          <h4 class="lighter smaller">选择产品类型</h4>
      </div>
      <div class="widget-body">
          <div class="widget-main padding-8">
              <div  id="treeDemo" class="ztree"></div>
          </div>
  </div>
  </div>
  </div>  
  </div>
   <div class="page_right_style">
   <div class="type_title">添加商品</div>
	<form action="__MODULE__/Product/productAdd" method="post" class="form form-horizontal" id="form-article-add" enctype="multipart/form-data">
		
		<div class=" clearfix cl">
         <label class="form-label col-2">简略标题：</label>
	     <div class="formControls col-10"><input type="text" class="input-text" value="{$post['name']}" placeholder="" id="" name="name"></span></div>
		</div>
		<div class=" clearfix cl">
			
			<div class="Add_p_s">
            <label class="form-label col-2">产品编号：</label>
			<div class="formControls col-2"><input type="text" class="input-text" value="{$post['number']}" placeholder="" id="" name="number"></span></div>
            </div>
			<div class="Add_p_s">
             <label class="form-label col-2">库&nbsp;&nbsp;&nbsp;&nbsp;存：</label>	
			 <div class="formControls col-2"><input type="text" class="input-text" value="{$post['totalnum']}" placeholder="" id="" name="totalnum"></div>
			</div>
            <div class="Add_p_s">
             <label class="form-label col-2">材质：</label>	
			 <div class="formControls col-2"><span class="select-box">
				<select class="select" name = "materail">
					<option>请选择</option>
					<foreach name="arrMaterail" item="v">
					<option value="{$v['id']}">{$v['materailname']}</option>
					</foreach>
				</select>
				</span></div>
			</div>
          <div class="Add_p_s">
             <label class="form-label col-2">风格样式：</label>	
			 <div class="formControls col-2"><span class="select-box">
				<select class="select" name = "style">
					<option>请选择</option>
					<foreach name="arrStyle" item="v">
					<option value="{$v['id']}">{$v['stylename']}</option>
					</foreach>
				</select>
				</span></div>
			</div>
			<div class="Add_p_s">
             <label class="form-label col-2">尺码：</label>	
			 <div class="formControls col-2"><span class="select-box">
				<select class="select" name = "size">
					<option>请选择</option>
					<option value="1">S</option>
					<option value="2">M</option>
					<option value="3">L</option>
					<option value="4">XL</option>
					<option value="5">XXL</option>
				</select>
				</span></div>
			</div>
             
            <div class="Add_p_s">
             <label class="form-label col-2">展示价格：</label>	
			 <div class="formControls col-2"><input type="text" class="input-text" value="{$post['price']}" placeholder="1.11" id="" name="price" >元</div>
			</div>
            <div class="Add_p_s">
             <label class="form-label col-2">VIP价格：</label>	
			 <div class="formControls col-2"><input type="text" class="input-text" value="{$post['vipprice']}" placeholder="1.11" id="" name="vipprice" >元</div>
			</div>
           
			
		</div>
		
		<div class="clearfix cl">
			<label class="form-label col-2">关键词：</label>
			<div class="formControls col-10">
				<input type="text" class="input-text" value="{$post['keyword']}" placeholder="" id="" name="keyword">
			</div>
		</div>
		<div class="clearfix cl">
			<label class="form-label col-2">规格包装：</label>
			<div class="formControls col-10">
				<textarea name="specification" cols="" rows="" class="textarea"  placeholder="说点什么...最少输入10个字符" datatype="*10-100" dragonfly="true" nullmsg="备注不能为空！" onKeyUp="textarealength(this,200)">{$post['specification']}</textarea>
				<p class="textarea-numberbar"><em class="textarea-length">0</em>/200</p>
			</div>
		</div>
		
		<div class="clearfix cl">
			<label class="form-label col-2">图片上传：</label>
			<div class="formControls col-10">
				<div class="uploader-list-container"> 
					<div class="queueList">
						
						<div id="dndArea" class="placeholder">	
							<p id="hint-images-add">单次最多可选100张</p>
						</div>
						
					</div>
					<div class="statusBar">
					<input type="file" name="images[]" style="display:none;" id="file"  multiple="multiple"/>
					<button class="layui-btn" type="button" id="changeFile">浏览...</button>
					</div>
				</div>
			</div>
		</div>
         <div class="layui-form-item layui-form-text">
			<label class="layui-form-label">描述</label>
			<div class="layui-input-block">
				<textarea name="content" id="demo"  autocomplete="off" class="layui-textarea"></textarea>
			</div>
		</div>
        
		<div class="clearfix cl">
			<div class="Button_operation">
				<button  class="btn btn-primary radius"  id="button" type="button"><i class="icon-save "></i>提交审核</button>
				<button  class="btn btn-secondary  btn-warning" type="button"><i class="icon-save"></i>保存草稿</button>
				<button  class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
				
			</div>
		</div>
		<input type="hidden" value="{$mes}" id="mes">
	</form>
    </div>
</div>
</div>
<script src="__PUBLIC__/js/admin/jquery-1.9.1.min.js"></script>   
<script src="__PUBLIC__/assets/js/bootstrap.min.js"></script>
<script src="__PUBLIC__/assets/js/typeahead-bs2.min.js"></script>
<script src="__PUBLIC__/assets/layer/layer.js" type="text/javascript" ></script>
<script src="__PUBLIC__/assets/laydate/laydate.js" type="text/javascript"></script>
<script type="text/javascript" src="__PUBLIC__/Widget/My97DatePicker/WdatePicker.js"></script> 
<script type="text/javascript" src="__PUBLIC__/Widget/icheck/jquery.icheck.min.js"></script> 
<script type="text/javascript" src="__PUBLIC__/Widget/zTree/js/jquery.ztree.all-3.5.min.js"></script> 
<script type="text/javascript" src="__PUBLIC__/Widget/Validform/5.3.2/Validform.min.js"></script> 
<script type="text/javascript" src="__PUBLIC__/Widget/webuploader/0.1.5/webuploader.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Widget/ueditor/1.4.3/ueditor.config.js"></script>
<script type="text/javascript" src="__PUBLIC__/Widget/ueditor/1.4.3/ueditor.all.min.js"> </script>
<script type="text/javascript" src="__PUBLIC__/Widget/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script> 
<script src="__PUBLIC__/js/admin/lrtk.js" type="text/javascript" ></script>
<script type="text/javascript" src="__PUBLIC__/js/admin/H-ui.js"></script> 
<script type="text/javascript" src="__PUBLIC__/js/admin/H-ui.admin.js"></script> 
<script>
$(function() { 
	$("#add_picture").fix({
		float : 'left',
		skin : 'green',	
		durationTime :false,
		stylewidth:'220',
		spacingw:0,
		spacingh:260,
	});
});
$( document).ready(function(){
//初始化宽度、高度
  
   $(".widget-box").height($(window).height()); 
   $(".page_right_style").height($(window).height()); 
   $(".page_right_style").width($(window).width()-220); 
  //当文档窗口发生改变时 触发  
    $(window).resize(function(){

	 $(".widget-box").height($(window).height()); 
	 $(".page_right_style").height($(window).height()); 
	 $(".page_right_style").width($(window).width()-220); 
	});	
});
$(function(){
	var ue = UE.getEditor('editor');
});
/******树状图********/
$.post('__MODULE__/Nav/navselect','',function(obj){
var setting = {
	view: {
		dblClickExpand: false,
		showLine: false,
		selectedMulti: false
	},
	data: {
		simpleData: {
			enable:true,
			idKey: "id",
			pIdKey: "fid",
			rootPId: ""
		}
	},
	callback: {
		beforeClick: function(treeId, treeNode) {
			var zTree = $.fn.zTree.getZTreeObj("tree");	
			console.log(treeNode.id);
				var id = treeNode.id;
				var fid = treeNode.fid;
				if(!fid){fid=0;}//若fid为0时，读取到的为空，再进行赋值
				var data="typefid="+fid+"&typeid="+id;
				$.get('__MODULE__/Product/productAdd',data,function(obj){
					
				},'json');				
				return true;
		
		}
	}
};

var zNodes =obj;
		
var code;
		
function showCode(str) {
	if (!code) code = $("#code");
	code.empty();
	code.append("<li>"+str+"</li>");
}
$(document).ready(function(){
	var t = $("#treeDemo");
	t = $.fn.zTree.init(t, setting, zNodes);
	
	demoIframe = $("#testIframe");
	//demoIframe.bind("load", loadReady);
	var zTree = $.fn.zTree.getZTreeObj("tree");
	//zTree.selectNode(zTree.getNodeByParam("id",'11'));
});	
},'json')
</script>
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	})
})

	
</script>
</body>
<script>
$('#button').click(function(){
	$.post('productAdd','action=checking',function(obj){
		if(obj.mes==5){
			layer.msg(obj.content,{icon:2});
		}else if(obj.mes==4){
			
			$("form").submit();//进行提交操作
			
		}
	},'json');
});
$('#changeFile').click(function(){
	$('#file').click();
	//图片显示在容器中
	var n=0;
	var url;
	$('#file').on('change',function(){
		$('#dndArea').removeClass('placeholder');
		$('#hint-images-add').remove();//去除图片添加显示
		for(n=0;n<this.files.length;n++){
			url = getURL(this.files[n]);//获取图片地址
			if(url){
				$("<img class="+n+" src="+url+" style='width:80px;height:100px;margin:0 6px 6px 0;'>").appendTo($('#dndArea'));
				$("."+n).hover(
						function(){
							layer.tips('双击删除',$(this));
						},
						function(){
							var index = layer.tips('双击删除',$(this));
							layer.close(index);
						}
				)
				$("."+n).dblclick(function(){				
					$(this).remove();
				})
			}
		}
		
	});

	//获得每张图片地址方法
	 function getURL(file){
		var objurl = null;
		  if(window.createObjectURL !=undefined){
			objurl = window.createObjectURL(file);
		}else if(window.URL !=undefined){
			objurl = window.URL.createObjectURL(file);
		}else  if(window.webkitURL !=undefined){
			objurl = window.webkitURL.createObjectURL(file);
		}
		return objurl;
	}; 

})
	layui.use('form', function(){
	 var form = layui.form(); //加载form 模块
	}); 
	//加载富文本编辑器
	layui.use('layedit',function(){
	var layedit = layui.layedit;
	layedit.build('demo');//建立编辑器
	});
	
	//判断添加操作成功与否
	var mes = $('#mes').val();
	if(mes==6){
		layer.msg('添加失败！',{icon:2});
	}else if(mes==1){
		layer.msg('添加成功！',{icon:1});
		
	}else if(mes==2){
		layer.msg('添加数据成功！生成缩略图失败！',{icon:3});
		
	}else if(mes==3){
		layer.msg('图片上传失败！',{icon:3});
	}
</script>
</html>